package cn.leonis.provider01.controller;

import cn.leonis.provider01.pojo.Product;
import cn.leonis.provider01.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("/product")
@RestController
public class ProductController {

    private final ProductService productService;

    @Autowired
    public ProductController(ProductService productService) {
        this.productService = productService;
    }

    @GetMapping("/all")
    public List<Product> selectAll() {
        System.out.println("我是provider1");
        return productService.selectAllProducts();
    }
}
